/**
 * This file is part of the CAKIS project.
 * 
 * Copyright (c) 2009-2010 - Florian Arndt, Christian Kerl
 * 
 * @license GNU Lesser General Public License v3 <http://www.opensource.org/licenses/lgpl-3.0.html>
 * @since   01.03.2010
 * @version SVN: $Id: StockService.java 156 2010-05-19 14:29:55Z christian-kerl@web.de $
 */

package org.cakis.server.service;

import org.cakis.server.model.BaseProduct;
import org.cakis.server.model.ProductListEntry;
import org.cakis.server.model.ProductQuantity;


/**
 * StockService
 *
 * @author Christian Kerl
 */
public interface StockService {

    /**
     * Adds a given number of items of the given product to the stock.
     * 
     * @param productId The id identifying the product of the items.
     * @param count The number of items to add.
     * 
     * @return True, if the method completed successful, false otherwise.
     * 
     * @throws ProductNotFoundException If the product identified by the given id does not exist.
     */
    boolean addStockItem(Long productId, int count) throws ProductNotFoundException;

    /**
     * Deletes a given number of items of the given product from the stock.
     * 
     * @param productId The id identifying the product of the items.
     * @param count The number of items to delete.
     * 
     * @return The number of successfully deleted items.
     * 
     * @throws ProductNotFoundException If the product identified by the given id does not exist.
     */
    int deleteStockItem(Long productId, int count) throws ProductNotFoundException;

    @javax.ejb.Local
    public static interface Local extends StockService {

        ProductListEntry getMissingNumberOfStockItemsFor(BaseProduct product, ProductQuantity quantity);
    }

    @javax.ejb.Remote
    public static interface Remote extends StockService {
    }
}
